<?php

namespace app\circle\model;

class CompanyModel extends BaseModel
{
    protected $name = 'circle_company'; //定义用户表
    //开启自动写入时间戳
    protected $autoWriteTimestamp = true;
    // 定义自动完成的属性
    protected $auto = []; //新增修改
    protected $insert = []; //插入
    protected $update = []; //修改
    //类型自动转换
    protected $type = [];

    /*读取器*/
    protected function getAddressTextAttr($value, $data)
    {
        $areaList           = cache('area');
        $address[] = $areaList[$data['company_prov']];
        $address[] = $areaList[$data['company_city']];
        $address[] = $areaList[$data['company_dist']];
        return implode(' ',$address);
    }

    public function getExamineTextAttr($value, $data)
    {
        $arr=[
            0=>'未审核',
            1=>'已审核'
        ];
        return $arr[$data['is_examine']];
    }

}